package com.rp.system.po;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.raptor.entity.BaseModel4;

/**
 * 菜单项，继承的是BaseModel4类，ID由程序生成
 * @author HuangJian
 *
 */
@Entity
@Table(name="RP_SYSTEM_MENUITEMS")
public class MenuItem extends BaseModel4 {

	private static final long serialVersionUID = -6129330131375389895L;
	
	private String text;				//显示文本
	private String url;					//链接地址
	private String iconCls;				//图标
	private String pid;					//父节点ID
	private String menuId;				//所属菜单ID
	private String menuName;			//所属菜单名称
	private String sort;				//排序级别
	private String verifyClose = "0";	//是否校验关闭
	
	private String enabled2 = "0";		//激活
	
	private List<MenuItem> children = new ArrayList<MenuItem>();
	
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getIconCls() {
		return iconCls;
	}
	public void setIconCls(String iconCls) {
		this.iconCls = iconCls;
	}
	public String getPid() {
		return pid;
	}
	public void setPid(String pid) {
		this.pid = pid;
	}
	public String getMenuId() {
		return menuId;
	}
	public void setMenuId(String menuId) {
		this.menuId = menuId;
	}
	public String getMenuName() {
		return menuName;
	}
	public void setMenuName(String menuName) {
		this.menuName = menuName;
	}
	
	public String getSort() {
		return sort;
	}
	public void setSort(String sort) {
		this.sort = sort;
	}
	
	public String getVerifyClose() {
		return verifyClose;
	}
	public void setVerifyClose(String verifyClose) {
		this.verifyClose = verifyClose;
	}
	public String getEnabled2() {
		return enabled2;
	}
	public void setEnabled2(String enabled2) {
		this.enabled2 = enabled2;
	}
	
	@Transient
	public List<MenuItem> getChildren() {
		return children;
	}
	public void setChildren(List<MenuItem> children) {
		this.children = children;
	}
	
	/**
	 * 重写了equals方法，ID相等则两个对象相等
	 */
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof MenuItem) {
			MenuItem menuItem = (MenuItem) obj;
			if (menuItem.getId().equals(this.getId())) {
				return true;
			}
		}
		return false;
	}
	
}
